<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      background: url('./images/1.jpg');
    }
    ul {
      list-style: none;
      padding: 0;
      border: 1px solid red;
      overflow: hidden;
      width: 370px;
      margin: 100px auto;
      background-color: #fff;
    }
    li {
      float: left;
      width: 80px;
      height: 50px;
      margin: 5px;
    }
    li img{
      width: 80px;
      height: 50px;
    }
  </style>
</head>
<body>
  <ul>
    <li><img src="./images/1.jpg" alt=""></li>
    <li><img src="./images/2.jpg" alt=""></li>
    <li><img src="./images/3.jpg" alt=""></li>
    <li><img src="./images/4.jpg" alt=""></li>
  </ul>
  <script>
    var list = document.querySelectorAll('img')

    for(var i = 0; i < list.length; i++) {
      list[i].onclick = function() {
        document.body.style.background = 'url(' + this.src + ')'
      }
    }
  </script>
</body>
</html>